package com.whty.ssm.db02.controller;
import com.alibaba.fastjson.JSON;
import com.whty.ssm.db02.pojo.Account;
import com.whty.ssm.db02.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
*  API服务 <br>
* Author: Crane(hehebaiy@gmail.com) <br>
* Create Time: 2017/7/7. <br>
* Version: v1.0.0 <br>
*/
// http://localhost:8080/myssm/account/deal?money=100
@Controller
@RequestMapping("/account")
public class AccountController {

   @Autowired
   private AccountService accountService;

   @RequestMapping("/deal")
   @ResponseBody
   public Map dealADeal(float money){
       Account from = new Account(1,"小明",1000f);
       Account to = new Account(2,"小红",1000f);
       String result  = accountService.goodIdea(from, to, money);
       Map map = new HashMap();
       map.put("result",result);
       return  map;
   }
}
